﻿#ifndef _FIELDS_H_H_
#define _FIELDS_H_H_

#include "udatabase/interface/ifields.h"
#include "udatabase/dll_cfg.h"

namespace FD
{
	namespace Utility
	{
		namespace DB
		{
			///<summary>
			///字段序列类
			///</summary>
			class FD_DB_Export CFields : public FD::Utility::DB::Interface::IFields
			{
			public:
				/// <summary>
				/// 默认构造函数
				/// </summary>
				/// <returns></returns>
				CFields();
				/// <summary>
				/// 默认析构函数
				/// </summary>
				/// <returns></returns>
				~CFields();
			public:
				/// <summary>
				/// 获取字段总数
				/// </summary>
				/// <param name=""></param>
				/// <returns>字段总数</returns>
				virtual UINT32 getCount() const;
				/// <summary>
				/// 获取索引index处的字段
				/// </summary>
				/// <param name="index">索引号</param>
				/// <returns>字段</returns>
				virtual const FD::Utility::DB::Interface::IField* getFieldRef(UINT32 index) const;
				/// <summary>
				/// 查询字段
				/// </summary>
				/// <param name="fieldName">字段名</param>
				/// <returns>成功返回字段索引号，失败返回-1</returns>
				virtual INT32 findField(const String& fieldName) const;
				/// <summary>
				/// 添加字段
				/// </summary>
				/// <param name="field">字段</param>
				/// <returns>字段总数</returns>
				virtual UINT32 addField(const FD::Utility::DB::Interface::IField* field);
				/// <summary>
				/// 删除索引index处的字段
				/// </summary>
				/// <param name="index">索引号</param>
				/// <returns>成功返回0，索引号小于0或者大于字段总数返回-1</returns>
				virtual UINT32 removeField(UINT32 index);
				/// <summary>
				/// 删除所有字段
				/// </summary>
				/// <param name=""></param>
				/// <returns>0</returns>
				virtual UINT32 clear();
				/// <summary>
				/// 移动字段
				/// </summary>
				/// <param name="srcIndex">原索引位置</param>
				/// <param name="srcIndex">目标索引位置</param>
				/// <returns>成功返回true,失败返回false</returns>
				virtual bool moveField(UINT32 srcIndex,UINT32 destIndex);
				/// <summary>
				/// 深度拷贝
				/// </summary>
				/// <param name=""></param>
				/// <returns>拷贝对象</returns>
				virtual FD::Utility::DB::Interface::IFields * clone() const;
			private:
				/* 字段映射 */
				std::vector<FD::Utility::DB::Interface::IField*>* mpFieldList;
				C_DISABLE_COPY(CFields);
			};
		} //GeoDataset
	}
}

#endif //_FIELDS_H_H_

